//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    // banner轮播
    bannerData: [
      {
        src: '../../static/image/bannerOne.jpg'
      }, {
        src: '../../static/image/bannerTwo.jpg'
      }, {
        src: '../../static/image/bannerThree.jpg'
      }
    ],
    // 小分类
    middleType: [
      {
        title: "单词",
        imgsrc: "../../static/image/words.jpg",
        linkTo: '../danci/danci'
      },
      {
        title: "音乐",
        imgsrc: "../../static/image/music.jpg",
        linkTo: '../yinyue/yinyue'
      },
      {
        title: "翻译",
        imgsrc: "../../static/image/translate.jpg",
        linkTo: '../translate/translate'
      },
      {
        title: "听力",
        imgsrc: "../../static/image/audio.jpg",
        linkTo: '../tingli/tingli'
      }
    ],
    // 精品推荐
    boutiqueData: [
      {
        title: "励志文章",
        imgsrc: "../../static/image/lizhi.jpg",
        linkTo: '../lizhiwenzhangg/lizhiwenzhangg'
      },
      {
        title: "每日一句",
        imgsrc: "../../static/image/duanwen.jpg",
        linkTo: '../meiriyingyu/meiriyingyu'
      },
      {
        title: "听力技巧",
        imgsrc: "../../static/image/tingli.jpg",
        linkTo: '../tinglijiqiao/tinglijiqiao'
      },
      {
        title: "快速资讯",
        imgsrc: "../../static/image/xinwen.jpg",
        linkTo: '../toutiaoxinwen/toutiaoxinwen'
      }
    ],
    // 训练营
    trainingData: [
      {
        title: "单词",
        imgsrc: "../../static/image/words.jpg",
        linkTo: '../danci/danci'
      }, {
        title: "翻译",
        imgsrc: "../../static/image/translate.jpg",
        linkTo: '../fanyi/fanyi'
      }, {
        title: "听力",
        imgsrc: "../../static/image/audio.jpg",
        linkTo: '../tingli/tingli'
      }
    ]
  },
  onLoad: function () {},

  linkTo(e) {
    const { item } = e.currentTarget.dataset;
    if(item.title === '翻译') {
      wx.switchTab({
        url: item.linkTo
      });
      return;
    }
    wx.navigateTo({
      url: item.linkTo
    });
  }
})
